<script>
	import { test } from '@/api/user.js'
	import { mapGetters } from "vuex";
	export default {
		onLaunch: function() {
			if(this.token) {
			    this.test();
			}
			this.checkMpUpdate();
		},
		onShow: function() {
			
			//console.log('App Show')
		},
		onHide: function() {
			//console.log('App Hide')
		},
		computed: {
			...mapGetters(['token'])
		},
		methods: {
			checkMpUpdate() {
				const updateManager = wx.getUpdateManager();
				updateManager.onUpdateReady(function() {
					wx.showModal({
						title: "更新提示",
						content: "新版本已准备好，是否重启？",
						success: function(res) {
							if (res.confirm) {
								// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
								updateManager.applyUpdate();
							}
						},
					});
				});
			},
			async test() {
				const { data }  = await test();
			}
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "/static/css/public.scss";
</style>
